<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<%
	if len(session("Login"))=0 then
		response.Redirect("Login.asp")
	end if
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Posting</title>

<style type="text/css">
<!--
#RtnMsg{
	position:absolute;
	font-size:36px;
	font-family:Comic Sans MS, cursive;
	font-weight:900;
	height:100%;
	top:50%; 
	margin-top:-18px;
	text-align:center;
	width:100%;
    color:#7e7e7e;
}
-->
</style>

<script type="text/javascript" src="./js/Common.js"></script>
<script type="text/javascript" language="javascript">
// <![CDATA[
tmrMove=0;
mTop= -18;

function Window_Load(){
	window.setTimeout(window.parent.fadeOut,1000);
	window.parent.fadeIn();
	window.parent.GetTopNow();
	if(!IsIELEQ7()) MoveThatDiv();
	window.setTimeout(KillMove,3000);
	Opacity("RtnMsg",80);
	window.parent.GetTopNow();
}

function KillMove(){
	window.clearTimeout(tmrMove);
}

function MoveThatDiv(){
	tmrMove=window.setTimeout(MoveThatDiv,10);
	mTop-=1;
	document.getElementById("RtnMsg").style.marginTop=mTop+"px";
}
// ]]>
</script>
</head>

<body bgcolor="transparent" style="background:none; height:100%" onload="Window_Load()">
    <div id="RtnMsg">
<%
	Message=request.Form("Msg")
	if len(session("Login"))>0 and len(request.Form("Msg"))>0 then
		Dim conn,cmd
		Set conn = Server.CreateObject("ADODB.Connection")
		Set cmd = Server.CreateObject("ADODB.Command")
		conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("..\Data\#Message Board.mdb")
		With cmd
			.ActiveConnection = conn
			.CommandType = &H0004 '存储过程
			.CommandText = "AddMessage"
		End With
		'生成一个UID
		Randomize
		Dim s
		For i = 1 To 20+CInt(Rnd * 9)
			if Rnd < 0.277777777777778 then
			s = s & Chr( 48 + CInt(Rnd * 9))
			else
			s = s & Chr(65 + CInt(Rnd * 25))
			end if
		Next
		'走~
		Message=replace(Message,vbcrlf,"<br/>")
		on error resume next
		cmd.Execute ,Array(session("Login"),Message,s)
		on error goto 0
		if err.number>0 then
%>
          <p align="center">
            Message Failed To Be Left :(
          </p>
<%
    	else
%>
          <p align="center">
            Message Posted +1<br />
          </p>
<%
		end if
		Set resultRS = Nothing
		Set cmd = Nothing
		conn.Close
		Set conn = Nothing
	else
%>
          <p align="center">
            No Message to Post!
          </p>
<%
	end if
%>
    </div>
</body>
</html>
